package main

import (
	"log"
	"net/http"
	"net/rpc"
)

type Params struct {
	Height, Width int
}

type React struct {
}

// Area 面积
func (r React) Area(param Params, result *int) error {

	*result = param.Width * param.Height

	return nil
}

// Perimeter 周长
func (r React) Perimeter(p Params, result *int) error {
	*result = (p.Width + p.Height) * 2
	return nil
}

func main() {

	react := &React{}
	_ = rpc.Register(react)
	rpc.HandleHTTP()
	err := http.ListenAndServe(":8000", nil)
	if err != nil {
		log.Panicln(err)
	}
}
